/**
 * 2017年3月12日
 */
package pojo.weichatlab.model;

import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

import cn.edu.bjtu.alex.rewrite.interfaces.Term;

/**
 * 注意 jstl Tag 与迭代器模型的组合
 * @author Alex
 *
 */
public final class LabelDocTermDTO implements Iterator<LDT>{
	
	Iterator<Entry<String, Map<String, Map<String, Term>>>> iter  = null;
	
	public LabelDocTermDTO(Iterator<Entry<String, Map<String, Map<String, Term>>>> iter) {
		this.iter = iter;
	}
	
	@Override
	public boolean hasNext() {
		// TODO Auto-generated method stub
		return iter.hasNext();
	}

	@Override
	public LDT next() {
		// TODO Auto-generated method stub
		Entry<String, Map<String, Map<String, Term>>> entry = iter.next();
		Iterator<Entry<String, Map<String, Term>>> docIter = entry.getValue().entrySet().iterator();
		int termCount = 0;
		while(docIter.hasNext()) {
			termCount += docIter.next().getValue().size();
		}
		return new LDT(entry.getKey(), entry.getValue().size(), termCount);
	}


	public void remove() {
		// TODO Auto-generated method stub
		
	}

}
